import axios from 'axios'
import cookie from 'js-cookie'
import {MessageBox,Message} from 'element-ui'
// 创建axios实例
const service = axios.create({
  baseURL: 'http://localhost:8222', // api的base_url
  timeout: 20000 // 请求超时时间
})

service.interceptors.request.use(
  config => {
  //debugger
  if (cookie.get('usertoken')) {
    //把获取cookie值放到header里面
    config.headers['token'] = cookie.get('usertoken');


  }
    return config
  },
  err => {
  return Promise.reject(err);
})


export default service